List of postgreSQL databases

List of postgreSQL databases

am 06.04.2010 13:22:19 von Renato Oliveira

--_000_7965A9DCF12CC14984420BCC37B1608F25ABF30DE5Elzargrantc ou_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Dear all,

I know to get a list of all databases on the system one can use: \l or (bac=
k slash) (ell)

Is there a specific 'STATEMENT' to display the same thing?
For example on MySQL, one would use: show databases;


Ps I can't seem to find this anywhere.

Thank you very much in advance.

Renato

Renato Oliveira
Systems Administrator
e-mail: renato.oliveira@grant.co.uk

Tel: +44 (0)1763 260811
Fax: +44 (0)1763 262410
www.grant.co.uk

Grant Instruments (Cambridge) Ltd

Company registered in England, registration number 658133

Registered office address:
29 Station Road,
Shepreth,
CAMBS SG8 6GB
UK





P Please consider the environment before printing this email
CONFIDENTIALITY: The information in this e-mail and any attachments is conf=
idential. It is intended only for the named recipients(s). If you are not t=
he named recipient please notify the sender immediately and do not disclose=
the contents to another person or take copies.

VIRUSES: The contents of this e-mail or attachment(s) may contain viruses w=
hich could damage your own computer system. Whilst Grant Instruments (Cambr=
idge) Ltd has taken every reasonable precaution to minimise this risk, we c=
annot accept liability for any damage which you sustain as a result of soft=
ware viruses. You should therefore carry out your own virus checks before o=
pening the attachment(s).

OpenXML: For information about the OpenXML file format in use within Grant =
Instruments please visit our website ..html>

--_000_7965A9DCF12CC14984420BCC37B1608F25ABF30DE5Elzargrantc ou_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

icrosoft.com/office/2004/12/omml" xmlns:o=3D"urn:schemas-microsoft-com:offi=
ce:office" xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:w=3D"urn:schemas=
-microsoft-com:office:word"> ascii" http-equiv=3D"Content-Type">
>












Dear all,



 



I know to get a list of all databases on the system on=
e can
use: \l or (back slash) (ell) an>



 



Is there a specific ‘STATEMENT’ to display=
the
same thing?



For example on MySQL, one would use: nt-family:
"Courier New"'>show databases
;



 



 



Ps I can’t seem to find this anywhere. >



 



Thank you very much in advance.



 



Renato






 

Renato=
Oliveira
Systems Administrator
e-mail: renato.oliveira@grant.co.uk FONT>
>

> 

Tel: +=
44 (0)1763 260811
Fax: +44 (0)1763 262410
..co.uk/">www.grant.co.uk

> 

Grant =
Instruments (Cambridge) Ltd
 
Company registered in England, re=
gistration number 658133
 
Registered office address:
29 Stat=
ion Road,
Shepreth,
CAMBS SG8 6GB
UK

> ONT> 

>

> 

>

 

>

 


; COLOR: green; FONT-FAMILY: Webdings"> 


; COLOR: green; FONT-FAMILY: Webdings">P =3D"EN-US" STYLE=3D"FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','=
sans-serif'">
OLOR: green; FONT-FAMILY: 'Arial','sans-serif'">Please consider the environ=
ment before printing this email


CONFIDENTIALITY: The =
information in this e-mail and any attachments is confidential. It is inten=
ded only for the named recipients(s). If you are not the named recipient pl=
ease notify the sender immediately and do not disclose the contents to anot=
her person or take copies.

 


VIRUSES: The contents=
of this e-mail or attachment(s) may contain viruses which could damage you=
r own computer system. Whilst Grant Instruments (Cambridge) Ltd has taken e=
very reasonable precaution to minimise this risk, we cannot accept liabilit=
y for any damage which you sustain as a result of software viruses. You sho=
uld therefore carry out your own virus checks before opening the attachment=
(s).

 


OpenXML: For informat=
ion about the OpenXML file format in use within Grant Instruments please vi=
sit our =


--_000_7965A9DCF12CC14984420BCC37B1608F25ABF30DE5Elzargrantc ou_--

Re: List of postgreSQL databases

am 06.04.2010 13:33:52 von devrim

--=-hWUpNVd2N+iYmSpfoaYs
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, 2010-04-06 at 12:22 +0100, Renato Oliveira wrote:
>=20
> I know to get a list of all databases on the system one can use: \l or
> (back slash) (ell)
>=20
> Is there a specific 'STATEMENT' to display the same thing?=20

Run psql with -E parameter, and then run \l. You'll see the query
there .

Regards,
--=20
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz

--=-hWUpNVd2N+iYmSpfoaYs
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAku7HB8ACgkQtl86P3SPfQ4X1ACgxA5NZmlyU4zyrhT+stQO sSUc
X8MAoKYexSd5OUcfjX3jFFnjqC8QbIyR
=rQ1N
-----END PGP SIGNATURE-----

--=-hWUpNVd2N+iYmSpfoaYs--

Re: List of postgreSQL databases

am 06.04.2010 13:39:35 von Sergey Konoplev

On 6 April 2010 15:22, Renato Oliveira wrote:
> Is there a specific =91STATEMENT=92 to display the same thing?

Try this

SELECT datname FROM pg_database;

--=20
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802

--=20
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: List of postgreSQL databases

am 06.04.2010 14:47:06 von Renato Oliveira

Sergey,

Thank you very much, this is more is great.

Best regards

Renato




Renato Oliveira
Systems Administrator
e-mail: renato.oliveira@grant.co.uk

Tel: +44 (0)1763 260811
Fax: +44 (0)1763 262410
http://www.grant.co.uk/

Grant Instruments (Cambridge) Ltd

Company registered in England, registration number 658133

Registered office address:
29 Station Road,
Shepreth,
CAMBS SG8 6GB
UK

-----Original Message-----


From: Sergey Konoplev [mailto:gray.ru@gmail.com]
Sent: 06 April 2010 12:40
To: Renato Oliveira
Cc: pgsql-admin
Subject: Re: [ADMIN] List of postgreSQL databases

On 6 April 2010 15:22, Renato Oliveira wrote:
> Is there a specific 'STATEMENT' to display the same thing?

Try this

SELECT datname FROM pg_database;

--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802



-----Original Message-----


P Please consider the environment before printing this email
CONFIDENTIALITY: The information in this e-mail and any attachments is conf=
idential. It is intended only for the named recipients(s). If you are not t=
he named recipient please notify the sender immediately and do not disclose=
the contents to another person or take copies.

VIRUSES: The contents of this e-mail or attachment(s) may contain viruses w=
hich could damage your own computer system. Whilst Grant Instruments (Cambr=
idge) Ltd has taken every reasonable precaution to minimise this risk, we c=
annot accept liability for any damage which you sustain as a result of soft=
ware viruses. You should therefore carry out your own virus checks before o=
pening the attachment(s).

OpenXML: For information about the OpenXML file format in use within Grant =
Instruments please visit our http://www.grant.co.uk/Support/openxml.html


--=20
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: List of postgreSQL databases

am 06.04.2010 14:48:45 von Renato Oliveira

Devrim,

Thank you very much

Renato



Renato Oliveira
Systems Administrator
e-mail: renato.oliveira@grant.co.uk

Tel: +44 (0)1763 260811
Fax: +44 (0)1763 262410
http://www.grant.co.uk/

Grant Instruments (Cambridge) Ltd

Company registered in England, registration number 658133

Registered office address:
29 Station Road,
Shepreth,
CAMBS SG8 6GB
UK

-----Original Message-----


From: Devrim GÜNDÜZ [mailto:devrim@gunduz.org]
Sent: 06 April 2010 12:34
To: Renato Oliveira
Cc: pgsql-admin
Subject: Re: [ADMIN] List of postgreSQL databases

On Tue, 2010-04-06 at 12:22 +0100, Renato Oliveira wrote:
>
> I know to get a list of all databases on the system one can use: \l or
> (back slash) (ell)
>
> Is there a specific 'STATEMENT' to display the same thing?

Run psql with -E parameter, and then run \l. You'll see the query there .

Regards,
--
Devrim GÜNDÜZ
PostgreSQL Danismani/Consultant, Red Hat Certified Engineer PostgreSQL RPM =
Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr http://www.gun=
duz.org Twitter: http://twitter.com/devrimgunduz


-----Original Message-----


P Please consider the environment before printing this email
CONFIDENTIALITY: The information in this e-mail and any attachments is conf=
idential. It is intended only for the named recipients(s). If you are not t=
he named recipient please notify the sender immediately and do not disclose=
the contents to another person or take copies.

VIRUSES: The contents of this e-mail or attachment(s) may contain viruses w=
hich could damage your own computer system. Whilst Grant Instruments (Cambr=
idge) Ltd has taken every reasonable precaution to minimise this risk, we c=
annot accept liability for any damage which you sustain as a result of soft=
ware viruses. You should therefore carry out your own virus checks before o=
pening the attachment(s).

OpenXML: For information about the OpenXML file format in use within Grant =
Instruments please visit our http://www.grant.co.uk/Support/openxml.html


--=20
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: List of postgreSQL databases

am 10.05.2010 20:40:01 von adsmail

Hello,

I want to raise this topic again.


On Tue, 6 Apr 2010 15:39:35 +0400 Sergey Konoplev wrote:

> On 6 April 2010 15:22, Renato Oliveira
> wrote:
> > Is there a specific â€=98STATEMENTâ€=99 to display the same thi=
ng?
>=20
> Try this
>=20
> SELECT datname FROM pg_database;

Is this guaranteed to stay forever? Right now I'm developing a tool
which needs to fetch the lost of available databases. Everytime
I implement a query using pg_* (even such a simple one) I have a bad
feeling about possible future compatibility issues.

Isn't there a way to make the list of databases available in
information_schema and change this view whenever the underlaying
structure might change?


Bye

--=20
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project

--=20
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: List of postgreSQL databases

am 10.05.2010 20:52:54 von Tom Lane

"Andreas 'ads' Scherbaum" writes:
>> SELECT datname FROM pg_database;

> Is this guaranteed to stay forever?

It seems reasonably unlikely that we'd change it. Even if we did,
we have in the past provided compatibility views (cf pg_user,
pg_shadow) when removing a catalog --- I would think the same would
happen for pg_database if we ever removed it.

> Isn't there a way to make the list of databases available in
> information_schema and change this view whenever the underlaying
> structure might change?

The point of information_schema is that it's standardized. There
is no view in the SQL standard that corresponds to a list of databases.
If you think there ought to be, take it up with the SQL committee.

regards, tom lane

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin